namespace xConnected.Data.Migrations
{
    using System.Data.Entity.Migrations;
    
    public partial class TranslationIntroduced : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "Translations",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Text = c.String(nullable: false, maxLength: 500),
                        LanguageId = c.Int(nullable: false),
                        IndustryTextId = c.Int(),
                        IndustryDescriptionId = c.Int(),
                        CategoryTextId = c.Int(),
                        CategoryDescriptionId = c.Int(),
                        EducationTextId = c.Int(),
                        CountryTextId = c.Int(),
                        LanguageTextId = c.Int(),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Languages", t => t.LanguageId, cascadeDelete: true)
                .ForeignKey("Languages", t => t.LanguageTextId)
                .ForeignKey("Educations", t => t.EducationTextId, cascadeDelete: true)
                .ForeignKey("Countries", t => t.CountryTextId, cascadeDelete: true)
                .ForeignKey("Categories", t => t.CategoryTextId, cascadeDelete: true)
                .ForeignKey("Categories", t => t.CategoryDescriptionId)
                .ForeignKey("Industries", t => t.IndustryTextId)
                .ForeignKey("Industries", t => t.IndustryDescriptionId)
                .Index(t => t.LanguageId)
                .Index(t => t.LanguageTextId)
                .Index(t => t.EducationTextId)
                .Index(t => t.CountryTextId)
                .Index(t => t.CategoryTextId)
                .Index(t => t.CategoryDescriptionId)
                .Index(t => t.IndustryTextId)
                .Index(t => t.IndustryDescriptionId);
            
        }
        
        public override void Down()
        {
            DropIndex("Translations", new[] { "IndustryDescriptionId" });
            DropIndex("Translations", new[] { "IndustryTextId" });
            DropIndex("Translations", new[] { "CategoryDescriptionId" });
            DropIndex("Translations", new[] { "CategoryTextId" });
            DropIndex("Translations", new[] { "CountryTextId" });
            DropIndex("Translations", new[] { "EducationTextId" });
            DropIndex("Translations", new[] { "LanguageTextId" });
            DropIndex("Translations", new[] { "LanguageId" });
            DropForeignKey("Translations", "IndustryDescriptionId", "Industries");
            DropForeignKey("Translations", "IndustryTextId", "Industries");
            DropForeignKey("Translations", "CategoryDescriptionId", "Categories");
            DropForeignKey("Translations", "CategoryTextId", "Categories");
            DropForeignKey("Translations", "CountryTextId", "Countries");
            DropForeignKey("Translations", "EducationTextId", "Educations");
            DropForeignKey("Translations", "LanguageTextId", "Languages");
            DropForeignKey("Translations", "LanguageId", "Languages");
            DropTable("Translations");
        }
    }
}
